#include "statistic.h"
#include <string.h>

statistic * stat_init(int maxlevel)
{
	statistic * stat;
	stat = (statistic *)malloc(sizeof(statistic));
	stat->node_num = (int *)malloc(maxlevel * sizeof(int));
	memset(stat->node_num, 0, maxlevel);
	stat->total_key_num = 0;
	stat->total_node_num = 0;
	if(stat)
		return stat;
	return NULL;
}

void stat_addnode(statistic * stat, int level)
{
	stat->node_num[level]++;
	stat->total_node_num++;
}

void stat_addkey(statistic * stat)
{
	stat->total_key_num++;
}